<!-- unit-tab2 -->
<template>
  <div class="unit-detail-tab animate__animated animate__zoomIn">
    <!-- 单位预警 -->
    <div class="detail-box detail5">
      <div class="box-info">
        <dv-border-box-12>
          <div class="info-top">
            <div class="top-title">
              <span>单位预警</span>
            </div>
          </div>
          <div class="info-main">
            <ul>
              <PublicListSmall :revListData="listData1"></PublicListSmall>
            </ul>
          </div>
        </dv-border-box-12>
      </div>
    </div>
    <!-- 事故及应急救援信息 -->
    <div class="detail-box detail5">
      <div class="box-info">
        <dv-border-box-12>
          <div class="info-top">
            <div class="top-title">
              <span>事故及应急救援信息</span>
            </div>
            <div class="top-tip">
              <span>总数：25 起</span>
              <span>参与救援数：0 起</span>
            </div>
          </div>
          <div class="info-main">
            <ul>
              <PublicListSmall :revListData="listData2"></PublicListSmall>
            </ul>
          </div>
        </dv-border-box-12>
      </div>
    </div>
    <!-- 监察信息 -->
    <div class="detail-box detail5">
      <div class="box-info">
        <dv-border-box-12>
          <div class="info-top">
            <div class="top-title">
              <span>监察信息</span>
            </div>
          </div>
          <div class="info-main">
            <ul>
              <PublicListSmall :revListData="listData3"></PublicListSmall>
            </ul>
          </div>
        </dv-border-box-12>
      </div>
    </div>
    <!-- 举报信息 -->
    <div class="detail-box detail5">
      <div class="box-info">
        <dv-border-box-12>
          <div class="info-top">
            <div class="top-title">
              <span>举报信息</span>
            </div>
          </div>
          <div class="info-main">
            <ul>
              <PublicListSmall :revListData="listData4"></PublicListSmall>
            </ul>
          </div>
        </dv-border-box-12>
      </div>
    </div>
    <!-- 行政处罚信息 -->
    <!-- <div class="detail-box detail5">
      <div class="box-info">
        <dv-border-box-12>
          <div class="info-top">
            <div class="top-title">
              <span>行政处罚信息</span>
            </div>
          </div>
          <div class="info-main">
            <ul>
              <PublicListSmall :revListData="listData5"></PublicListSmall>
            </ul>
          </div>
        </dv-border-box-12>
      </div>
    </div> -->
    <!-- 应急预案演练信息 -->
    <!-- <div class="detail-box detail5">
      <div class="box-info">
        <dv-border-box-12>
          <div class="info-top">
            <div class="top-title">
              <span>应急预案演练信息</span>
            </div>
          </div>
          <div class="info-main">
            <ul>
              <PublicListSmall :revListData="listData1"></PublicListSmall>
            </ul>
          </div>
        </dv-border-box-12>
      </div>
    </div> -->
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
import PublicListSmall from "../list/PublicListSmall";

export default {
  //import引入的组件需要注入到对象中才能使用
  components: { PublicListSmall },
  data() {
    //这里存放数据
    return {
      listData1: {
        head: [
          { name: "预警名称", prop: "p1" },
          { name: "预警数量", prop: "p2" },
        ],
        body: [
          {
            p1: "设备即将超期预警",
            p2: "3",
          },
          {
            p1: "设备超期未检预警",
            p2: "2",
          },
          {
            p1: "人员无证预警",
            p2: "1",
          },
          {
            p1: "单位整改预警",
            p2: "1",
          },
        ],
      },
      listData2: {
        head: [
          { name: "救援时间", prop: "p1" },
          { name: "事故设备类型", prop: "p2" },
          { name: "事故内容", prop: "p3" },
          { name: "应急救援单位", prop: "p4" },
          { name: "处置情况", prop: "col" },
        ],
        body: [
          {
            p1: "2020-11-11",
            p2: "锅炉",
            p3: "锅炉爆炸",
            p4: "-",
            col: "",
          },
          {
            p1: "2020-11-11",
            p2: "锅炉",
            p3: "锅炉爆炸",
            p4: "-",
            col: "",
          },
        ],
      },
      listData3: {
        head: [
          { name: "开始时间", prop: "p1" },
          { name: "结束时间", prop: "p2" },
          { name: "监察记录", prop: "p3" },
        ],
        body: [
          {
            p1: "2020-11-11",
            p2: "锅炉运行情况",
            p3: "群众举报",
          },
        ],
      },
      listData4: {
        head: [
          { name: "举报日期", prop: "p1" },
          { name: "举报设备", prop: "p2" },
          { name: "处置内容", prop: "p3" },
          { name: "处置详情", prop: "col" },
        ],
        body: [
          {
            p1: "2020-11-11",
            p2: "电梯停梯",
            p3: "已处置",
            col: "",
          },
        ],
      },
    };
  },
  props: {
    tabData: {},
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {},
  //生命周期 - 创建完成（可以访问当前this实例）
  created() {
    console.log("收到tabData");
    console.log(this.tabData);
    // 单位预警
    this.listData1.body = [
      {
        p1: "设备即将超期预警",
        p2: this.tabData.comWarning.will_due,
      },
      {
        p1: "设备超期未检预警",
        p2: this.tabData.comWarning.is_due,
      },
      {
        p1: "人员无证预警",
        p2: this.tabData.comWarning.staff_wnum,
      },
      {
        p1: "单位整改预警",
        p2: this.tabData.comWarning.danger_num,
      },
    ];
    // 事故....
    var body2 = []
    this.tabData.comEmergy.forEach(ele => {
      // console.log(ele);
      let arr = {
        p1: ele.acc_time,
        p2: ele.dev_name,
        p3: ele.remarks,
        p4: ele.emergency_com,
        col: "",
      }
      body2.push(arr)
    });
    
    this.listData2.body = body2
    
    // 监察信息
    var body3 = []
    this.tabData.comMoi.forEach(ele => {
      // console.log(ele);
      let arr = {
            p1: ele.start_time,
            p2: ele.finish_time,
            p3: ele.conclusion,
            // col: "",
          }
      body3.push(arr)
    });
    // console.log(body3);
    this.listData3.body = body3
    
    // 举报
    var body4 = []
    this.tabData.comReport.forEach(ele => {
      // console.log(ele);
      let arr = {
            p1: ele.acc_time,
            p2: ele.dev_name,
            p3: ele.remarks,
            col: "",
          }
      body4.push(arr)
    });
    // console.log(body4);
    this.listData4.body = body4
  },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='less' scoped>
//@import url(); 引入公共css类
.unit-detail-tab {
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  .detail-box {
    width: 50%;
    height: 45%;
    display: flex;
    justify-content: center;
    align-items: center;
    .box-info {
      width: 95%;
      height: 100%;
      .info-top {
        width: 100%;
        height: 20%;
        // background-color: pink;
        display: flex;
        .top-title {
          width: 30%;
          height: 100%;
          display: flex;
          justify-content: center;
          align-items: center;
          span {
            font-size: 0.24rem;
            font-weight: 700;
            color: @Green;
          }
        }
        .top-tip {
          width: 80%;
          height: 100%;
          display: flex;
          justify-content: space-evenly;
          align-items: center;
          span {
            font-size: 0.18rem;
            color: @FontColor;
          }
        }
      }
      .info-main {
        width: 100%;
        height: 65%;
        ul {
          width: 90%;
          height: 100%;
          margin: 0 auto;
          li {
            width: 100%;
            height: 20%;
            display: flex;
            .li-box {
              flex: 1;
              color: #eee;
              font-size: 0.18rem;
              display: flex;
              justify-content: space-evenly;
              align-items: center;
              span {
                display: block;
                text-align: left;
                width: 100%;
                height: 80%;
              }
              span:first-child {
                color: #ccc;
                font-weight: 700;
              }
            }
          }
        }
      }
    }
  }
}
</style>